home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2662 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.6 KB  |  56 lines

  1. Path: wolverine.trilogy.com!usenet
  2. From: "D. Allan Drummond" <allan.drummond@trilogy.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: STL and VC 4.0 and namespaces
  5. Date: Thu, 18 Jan 1996 18:21:57 -0600
  6. Organization: Trilogy
  7. Message-ID: <30FEE425.2BEF@trilogy.com>
  8. References: <30FE67B2.3196@email.usps.gov>
  9. NNTP-Posting-Host: omnivore.trilogy.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b3 (WinNT; I)
  14. CC: cjohnso7@email.usps.gov
  15.  
  16. Craig Johnson wrote:
  17. > I just got the book C++ Programmer's Guide to the Standard
  18. > Template Library, read the first 150 pages, and am trying to
  19. > used the vector template.  I am using Visual C++ 4.0 and I get
  20. > the following errors.
  21. > d:\apps32\msdev\stl\iterator.h(65) : warning C4114: same type
  22. > qualifier used more than once
  23. > d:\apps32\msdev\stl\defalloc.h(124) : error C2661: 'new' : no
  24. > overloaded function takes 2 parameters
  25.  
  26.  
  27. I got the same behavior.  The way I solved it is to do this:
  28.  
  29. #include <new.h>
  30. namespace std
  31. {
  32. #include <vector.h>
  33. }
  34.  
  35. This should fix the error (the problem is that the global 
  36. placement new operator is not visible to the defalloc.h file - 
  37. putting <new.h> outside the namespace lets it see it again).
  38.  
  39. However, I later had to abandon wrapping the STL stuff in the 
  40. std namespace due to problems with ambiguous calls to operator 
  41. != when writing things like this:
  42.  
  43. vector<char> ch;
  44. // ...fill ch with stuff...
  45.  
  46. vector<char>::iterator i( ch.begin() );
  47. for( ; i != ch.end(); i++ )
  48.     cout << *i;
  49.  
  50. Has anyone else encountered this type of problem?
  51.  
  52.  
  53. Allan
  54.